package com.hpq.chat.domain.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.hpq.chat.domain.model.msg.MessageExtra;
import lombok.*;

import java.io.Serializable;
import java.util.Date;

/**
 *消息表
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName(value = "message", autoResultMap = true)
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class Message implements Serializable {
    private static final long serialVersionUID = 1L;
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    /**
     * 房间id
     */
    private Long roomId;
    /**
     * 发送者id
     */
    private Long fromUid;
    /**
     * 消息内容
     */
    private String content;
    /**
     * 回复的消息id
     */
    private Long replyMsgId;
    /**
     * 消息状态(0:正常;1:删除)
     */
    private Integer status;
    /**
     *消息未读数
     */
    private Integer gapCount;
    /**
     * 消息类型(1:正常文本，2:撤回消息)
     */
    private Integer type;
    /**
     * 消息拓展信息
     */
    @TableField(value= "extra",typeHandler = JacksonTypeHandler.class)
    private MessageExtra extra;
    /**
     * 创建时间
     */
    private Date createTime;
    /**
     * 更新时间
     */
    private Date updateTime;
}
